import Vue from 'vue'
import HeyUI from 'heyui';
import "heyui/themes/index.less";
Vue.use(HeyUI);
import App from './App.vue'
import router from './router'
import store from './store'
import UI_Manage from '@/components'
import '@fortawesome/fontawesome-free/css/all.css'
import "@/css/theme.less";
import "@/css/index.less";
import CoreApi from '@/libs/api'
import Terminal from '@/libs/Terminal'
import FileManage from '@/libs/FileManage'
UI_Manage.autoComponent()
const routerMap = router.autoMap()//自动映射路由
Vue.config.productionTip = false
let API_DOMAIN = '47.97.102.198'
// Vue.prototype.$API=new CoreApi(API_DOMAIN)//初始化API接口
Vue.prototype.$API = new CoreApi()//初始化API接口
Vue.prototype.$file = new FileManage()//初始化文件管理器接口
Vue.prototype.$Terminal = new Terminal(API_DOMAIN)//初始化终端
if (!String.prototype.padStart) {
  String.prototype.padStart = function padStart(targetLength, padString) {
    targetLength = targetLength >> 0; //floor if number or convert non-number to 0;
    padString = String((typeof padString !== 'undefined' ? padString : ' '));
    if (this.length > targetLength) {
      return String(this);
    }
    else {
      targetLength = targetLength - this.length;
      if (targetLength > padString.length) {
        padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
      }
      return padString.slice(0, targetLength) + String(this);
    }
  };
}
Date.prototype.format = function (fmt) {
  var o = {
    "M+": this.getMonth() + 1,                 //月份 
    "d+": this.getDate(),                    //日 
    "h+": this.getHours(),                   //小时 
    "m+": this.getMinutes(),                 //分 
    "s+": this.getSeconds(),                 //秒 
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
    "S": this.getMilliseconds()             //毫秒 
  };
  if (/(y+)/.test(fmt)) {
    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  }
  for (var k in o) {
    if (new RegExp("(" + k + ")").test(fmt)) {
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    }
  }
  return fmt;
}
new Vue({
  router: routerMap,
  store,
  render: h => h(App)
}).$mount('#app')
